package com.study.design.pattern.pattern.creational.prototype;

import lombok.Data;
import java.util.Date;

/**
 * @Author: gongsl
 * @Date: 2025-03-08 23:44
 * @description:
 */
@Data
public class Persion implements Cloneable {
    private String name;
    private int age;
    private Date birthDay;

    public Persion() {
        System.out.println("调用了无参的构造方法!");
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Persion persion = (Persion) super.clone();
        Date birthDay = (Date) persion.getBirthDay().clone();
        persion.setBirthDay(birthDay);
        return persion;
    }
}
